<?
require_once("../config/dbconn.php");require_once("../config/usercls.php");require_once("../config/pagecls.php");
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	 
}
td{
font-size:12px;
}
-->
</style>

<link href="images/skin.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="17" height="29" valign="top"></td>
    <td width="100%" height="29" valign="top"  ><table width="100%" height="31" border="1" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
      <tr>
        <td height="31"><div class="titlebt">&nbsp;&nbsp;公告列表</div></td>
      </tr>
    </table></td>
    <td width="16" valign="top" ></td>
  </tr>
  <tr>
    <td height="71" valign="middle" >&nbsp;</td>
    <td valign="top"><table width="100%" height="138" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="13" valign="top">&nbsp;</td>
      </tr>
      <tr>
        <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td></td>
            </tr>
            <tr>
              <td height="30"><table width="100%" height="60" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td height="30" align="left" bgcolor="#f2f2f2" >标题</td>
                  <td width="100" align="center" bgcolor="#f2f2f2" >发布时间</td>
                  </tr>
				  <?
  $query='';
  if ($act=='query'){
  	if ($nsortid!=''){
		$pstr='';
		$sqlf="select id,flname from {$db_prefix}nsort where find_in_set('$npsortid',path)>0 or id='$nsortid'";
		$resultf=$db->query($sqlf);
		while($rsf=$db->fetch_array($resultf)){
			if ($pstr!='') $pstr.=',';$pstr.=$rsf['id'];
		}
		$db->free_result($resultf);
		
		if ($pstr!=''){
			$query.=" and find_in_set(nsortid,'$pstr')>0";
		}
	}	
	if (trim($title)!='') $query.=" and title like '%".trim($title)."%'";
  }
  
  $sql="select count(id) as c  from {$db_prefix}announces where 1";
  if ($query!='') $sql.=$query;
  $rs=$db->get_one($sql);
  $page=new pagecls(20,intval($rs['c']));
  $sql="select * from {$db_prefix}announces where 1";
  if ($query!='') $sql.=$query;
  $sql.=" order by istop desc,id desc limit {$page->pastnum},{$page->pagesize}";
  $result=$db->query($sql);
  $i=0;
  while($rs=$db->fetch_array($result)){
  ?>
                <tr>
                  <td height="30" align="left" class="hm1">
				  <?
				  if($i<5){
				  ?>
				  <img src="images/new.gif" border="0">
				  <?
				  }
				  ?>
				  <a href="announce_view.php?id=<?=$rs['id']?> class="hm1"" ><?=$rs['title']?></a></td>
                  <td align="center" ><?=date("Y-m-d",$rs['addtime'])?></td>
                  </tr>
				   <?
				   $i++;
  }
  $db->free_result($result);
  ?>
              </table></td>
            </tr>
            
            <tr>
              <td height="30">&nbsp;</td>
            </tr>
            <tr>
              <td height="30" align="right">每页<?=$page->pagesize?>条 第<?=$page->pageno?>/<?=$page->pagenum?>页 共<?=$page->recnum?>条 <a href='?<?=$page->url?>1'><img src="image1/first.gif" border="0"></a>   <a href='?<?=$page->url.($page->pageno-1)?>'><img src="image1/back.gif" border="0"></a>  <a href='?<?=$page->url.($page->pageno+1)?>'><img src="image1/next.gif" border="0"></a>   <a href='?<?=$page->url.$page->pagenum?>'><img src="image1/last.gif" border="0"></a></td>
              </tr>
            <tr>
              <td height="30">&nbsp;</td>
            </tr>
          </table></td>
      </tr>
    </table></td>
    <td >&nbsp;</td>
  </tr>
  <tr>
    <td valign="middle" ></td>
      <td height="17" valign="top" >&nbsp;</td>
    <td ></td>
  </tr>
</table>

</body>
</html>
